class CartInfoBeanResult {
  String? goodsName; //商品的名字
  String? imagesUrl; //商品图片的url
  int? count; //商品在购物车中的数量
  double? price; //商品的价格
  int? goodsId; //商品的id,用于区分每个商品
  bool? isCheck;//商品是否选中

  //构造方法
  CartInfoBeanResult(
      this.goodsName, this.imagesUrl, this.count, this.price, this.goodsId,this.isCheck);

  //fromJson方法,把一个json转换为一个bean类 dynamic代表动态的意思,相当于java中object,或者kotlin中的any
  CartInfoBeanResult.fromJson(Map<String, dynamic> json) {
    goodsName = json['goodsName'];
    imagesUrl = json['imagesUrl'];
    count = json['count'];
    price = json['price'];
    goodsId = json['goodsId'];
    isCheck = json['isCheck'];
  }

  //将bean类转换为json
  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['goodsName'] = goodsName;
    data['imagesUrl'] = imagesUrl;
    data['count'] = count;
    data['price'] = price;
    data['goodsId'] = goodsId;
    data['isCheck'] = isCheck;
    return data;
  }
}
